#region

using System;
using System.ComponentModel.DataAnnotations;
using ThuySan.Bussiness;

#endregion

namespace ThuySan.Models
{
    [Serializable]
    public partial class CategoryPropertyModel
    {
        #region Constructor

        public CategoryPropertyModel()
        {
        }

        public CategoryPropertyModel(CategoryProperty value)
        {
            CategoryPropertyId = value.CategoryPropertyId;
            CategoryId = value.CategoryId;
            PropertyId = value.PropertyId;
            Priority = value.Priority;
        }

        #endregion

        #region Fields

        private Int32? _CategoryId;

        private Int32 _CategoryPropertyId;

        private Int32? _Priority;

        private Int32? _PropertyId;

        #endregion

        #region Properties

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32 CategoryPropertyId
        {
            get { return _CategoryPropertyId; }
            set { _CategoryPropertyId = value; }
        }

        //[NotChanged]
        [Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? CategoryId
        {
            get { return _CategoryId; }
            set { _CategoryId = value; }
        }

        //[NotChanged]
        [Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? PropertyId
        {
            get { return _PropertyId; }
            set { _PropertyId = value; }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? Priority
        {
            get { return _Priority; }
            set { _Priority = value; }
        }

        #endregion

        #region Operators

        public void Update(CategoryProperty value)
        {
            //value.CategoryPropertyId = CategoryPropertyId;
            value.CategoryId = CategoryId;
            value.PropertyId = PropertyId;
            value.Priority = Priority;
        }

        public static implicit operator CategoryPropertyModel(CategoryProperty obj)
        {
            return new CategoryPropertyModel(obj);
        }

        public static implicit operator CategoryProperty(CategoryPropertyModel obj)
        {
            CategoryProperty value = new CategoryProperty();
            obj.Update(value);
            return value;
        }

        #endregion
    }
}
